<template>
    <div class='common_header'>
        <van-icon class='text-left' name="arrow-left" @click='fn' />
        <span><slot>默认值</slot></span>
        <van-icon class='text-right' name="ellipsis" v-if='showmore' />
        <i v-else></i>
    </div>
</template>
<script>
// @ is an alias to /src
export default {
    name: 'myheader',
    props:{
      showmore:{
        default:false
      }
    },
    data() {
        return {
        
        }
    },
    components: {
        
    },
    methods: {
      fn(){
        if(this.$listeners.back){
          // 用户使用了我们的自定义事件back
          this.$emit('back')
        }else{
          this.$router.back()
        }
        // console.log(this.$listeners)
        
      }
    },
}
</script>
<style lang="less">
.common_header{
  display: flex;
  text-align: center;
  width: 100%;
  height: 40px;
  align-items: center;
  border-bottom:1px solid #eee;
  font-size: 16px;
  i,span{
    flex:1;
    padding: 0 10px;
  }
  .text-left{
    text-align: left;
  }
  .text-right{
    text-align: right;
  }

}
</style>